﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using CrossRoadNS.Model;
using System.Windows.Media;

namespace CrossRoadNS.Services.Converters
{
    class TrafficLightStateToColorConv : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var state = (TrafficLightStates)value;
            SolidColorBrush result = new SolidColorBrush(Colors.Transparent);
            switch (state)
            {
                case TrafficLightStates.Red:
                    result.Color = Colors.Red;
                    break;
                case TrafficLightStates.RedYellow:
                    result.Color = Colors.OrangeRed;
                    break;
                case TrafficLightStates.Yellow:
                    result.Color = Colors.Yellow;
                    break;
                case TrafficLightStates.Green:
                    result.Color = Colors.Green;
                    break;
                case TrafficLightStates.YellowBlinking:
                    result.Color = Colors.Yellow;
                    break;
                default:
                    result.Color = Colors.Transparent;
                    break;
            }
            return result;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }


    }
}
